<?php

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

//-----------------------------

module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$connectionHelper = new ConnectionHelper();
//$soapClient = $connectionHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'));
$soapClient = $connectionHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl'));
$params = array(
          'pid' => 'islandora:demos',
          'dsID' => 'DC',
		  'asOfDateTime' => null
      );

//$object = $soapClient->__soapCall('getDatastreamDissemination', array('parameters' => $params));

//print $object;

//-----------------------------
//$item = new fedora_item('islandora:nan');
//$dc = $item->get_datastream_dissemination('RELS-EXT',null);

//print htmlspecialchars($dc);

//$item->add_datastream_from_string('<abc>abc</abc>', 'NNN');

/*
fedora_item::ingest_new_item('islandora:nan1', 'A', 'Nan1', 'Admin');
$item = new fedora_item('islandora:nan1');
$item->add_datastream_from_url('http://www.criticalcarethai.org/pdf/46/lesson23.pdf','OBJ','mypdf','application/pdf','M');
$item->add_datastream_from_url('http://www.iamsell.com/icon/Blue-Kikyo-icon.jpg','TN','tn','image/jpeg','M');
$item->add_relationship('fedora:isMemberOfCollection','info:fedora/islandora:pdf_collection');
$item->add_relationship('fedora-model:hasModel','info:fedora/islandora:strict_pdf', 'info:fedora/fedora-system:def/model#');

*/

$item = new fedora_item('herbarium:4');
$dwc = $item->get_datastream_dissemination('RDF_KREF');
print htmlspecialchars($dwc);

//-----------------------------


$return = menu_execute_active_handler();

// Menu status constants are integers; page content is a string.
if (is_int($return)) {
  switch ($return) {
    case MENU_NOT_FOUND:
      drupal_not_found();
      break;
    case MENU_ACCESS_DENIED:
      drupal_access_denied();
      break;
    case MENU_SITE_OFFLINE:
      drupal_site_offline();
      break;
  }
}
elseif (isset($return)) {
  // Print any value (including an empty string) except NULL or undefined:
  print theme('page', $return);
}






drupal_page_footer();